Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: print error source #740

Merged
merged 1 commit into from
Jul 16, 2024
Merged

CLI: print error source #740

merged 1 commit into from
Jul 16, 2024

Conversation

wfchandler
Copy link
Contributor

Currently the oxide binary will print the error returned when a
subcommand fails, but not any source errors attached to it. In the
context of connection failures from the auth login subcommand, the
output was only Request failed, giving the user no context on why the
failure occurred.

If present, append the source of the error to the user-facing message.

Previously:

$ oxide auth login --host oxide.invalid
Request failed

Now:

$ oxide auth login --host oxide.invalid
Request failed: error sending request for url (http://oxide.invalid/device/auth): error trying to connect: dns error: failed to lookup address information: nodename nor servname  provided, or not known

@wfchandler wfchandler force-pushed the wc/print-err-source branch from dd741e3 to d35dc80 Compare July 12, 2024 18:19
@wfchandler wfchandler marked this pull request as ready for review July 12, 2024 18:28
@wfchandler wfchandler requested a review from ahl July 12, 2024 18:29
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this

cli/src/cmd_auth.rs Outdated Show resolved Hide resolved
cli/src/cmd_auth.rs Outdated Show resolved Hide resolved
cli/src/cmd_auth.rs Outdated Show resolved Hide resolved
Currently the `oxide` binary will print the error returned when a
subcommand fails, but not any `source` errors attached to it. In the
context of connection failures from the `auth login` subcommand, the
output was only `Request failed`, giving the user no context on why the
failure occurred.

If present, append the source of the error to the user-facing message.

Previously:
```
$ oxide auth login --host oxide.invalid
Request failed
```

Now:
```
$ oxide auth login --host oxide.invalid
Request failed: error sending request for url \
 (http://oxide.invalid/device/auth): error trying to connect: dns \
 error: failed to lookup address information: nodename nor servname \
 provided, or not known
```
@wfchandler wfchandler force-pushed the wc/print-err-source branch from d35dc80 to d13b4bb Compare July 16, 2024 13:43
@wfchandler
Copy link
Contributor Author

Ready for another look @ahl, the other changes you had comments on were all removed by #727.

@wfchandler wfchandler requested a review from ahl July 16, 2024 13:58
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legend

@ahl ahl merged commit c926441 into main Jul 16, 2024
16 checks passed
@ahl ahl deleted the wc/print-err-source branch July 16, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants